<template>
  <view class="my-search-container" :style="{'background-color':bgcolor}" @click="searchHandler">
    <!-- 使用view组件模拟input输入框的样式 -->
    <view class="my-search-box"  :style="{'border-radius':radius+'px'}">
      <uni-icons type="search" size="17"></uni-icons>
      <text class="placeholder">搜索</text>
    </view>
  </view>
</template>
<script>
  export default {
    data() {
      return {
        
      };
    },
    props:{
      // 背景颜色
      bgcolor:{
        type:String,
        default:"#c00000"
      },
      // 圆角尺寸
      radius:{
        type:Number,
        default:15
      }
    },
    methods:{
      searchHandler(){
        //触发自定义事件
        this.$emit("click")
      }
    }
  }
</script>
<style scoped lang="scss">
  .my-search-container{
    height: 50px;
    padding: 0 10px;
    display: flex;
    align-items: center;
  }
  .my-search-box{
    background-color: #ffffff;
    height: 36px;
    width: 100%;
   display: flex;
   justify-content: center;
   align-items: center;
   .placeholder{
     font-size: 15px;
     margin-left: 5px;
   }
  }
</style>
